package LeetCode_876;

import LeetCode_206.ListNode;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2022/10/22 23:37
 */
public class Solution {
    public ListNode middleNode(ListNode head) {
        int length = 0;
        ListNode tem = head;
        while (tem != null) {
            tem = tem.next;
            length++;
        }
        for (int i = 0; i < length / 2; i++) {
            head = head.next;
        }
        return head;
    }
}
